package com.css.zfzx.fwsjcj.modules.structure.repository;

import com.css.zfzx.fwsjcj.modules.structure.entity.FwBrickStructureEntity;
import com.css.zfzx.fwsjcj.modules.structure.entity.FwBrickwoodStructureEntity;
import com.css.zfzx.fwsjcj.modules.structure.vo.TestVo;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author leon
 * @Title: FwBrickStructureRepository
 * @Description: 砖混结构
 * @date 2020/6/3 10:05
 */
@Repository
public interface FwBrickwoodStructureRepository extends JpaRepository<FwBrickwoodStructureEntity, String>,
         JpaSpecificationExecutor<FwBrickwoodStructureEntity> {

    @Query(nativeQuery = true, value = "select * from fw_brickwood_structure where id in :idList")
    List<FwBrickwoodStructureEntity> findInIdList(@Param("idList") List<String> idList);


    FwBrickwoodStructureEntity findByBrickwoodStructureNumAndDelFlag(String brickwoodStructureNum, String isValid);

    @Modifying
    @Query(nativeQuery = true, value = "update fw_brickwood_structure set detail_file =:fileId where id =:formId")
    void update(@Param("formId") String formId, @Param("fileId") String fileId);
}
